﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CNVP.JShop.UI;

using CNVP.Framework.Utils;

namespace CNVP.JShop.Web.Admin
{
    public partial class ProductTypeEdit : AdminPage
    {
        BLL.CNVP_ProductType bll = new BLL.CNVP_ProductType();
        Model.CNVP_ProductType model = new Model.CNVP_ProductType();
        public int id = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!BLL.BLLCheckAdmin.LoginOk(Page, 72)) return;//判断页面权限
            if (!string.IsNullOrEmpty(Request.QueryString["ID"]) && Public.IsNumber(Request.QueryString["ID"]))
            {
                id = Convert.ToInt32(Request.QueryString["ID"]);
            }
            if (!IsPostBack)
            {
                if (id > 0)
                {
                    lbTitle.Text = " > 修改";
                    DataInfo(id);
                }
                else
                {
                    lbTitle.Text = " > 添加";
                }
            }
        }

        public void DataInfo(int id)
        {
            model = bll.GetSingle_CNVP_ProductTypeById(id);
            if (model != null)
            {
                rblIsEntityType.SelectedValue = model.IsEntityType.ToString();
                rblIsRefBranks.SelectedValue = model.IsRefBranks.ToString();
                rblIsRefExtendProperty.SelectedValue = model.IsRefExtendProperty.ToString();
                rblIsRefDescripttion.SelectedValue = model.IsRefDescripttion.ToString();
                rblIsRefShopMustInfo.SelectedValue = model.IsRefShopMustInfo.ToString();
            }

        }

        protected void btUp_Click(object sender, EventArgs e)
        {
            string IsEntityType = rblIsEntityType.SelectedValue;
            string IsRefBranks = rblIsRefBranks.SelectedValue;
            string IsRefExtendProperty = rblIsRefExtendProperty.SelectedValue;
            string IsRefDescripttion = rblIsRefDescripttion.SelectedValue;
            string IsRefShopMustInfo = rblIsRefShopMustInfo.SelectedValue;
            string Url = "ID=" + id;
            Url += "&IsEntityType=" + IsEntityType;
            Url += "&IsRefBranks=" + IsRefBranks;
            Url += "&IsRefExtendProperty=" + IsRefExtendProperty;
            Url += "&IsRefDescripttion=" + IsRefDescripttion;
            Url += "&IsRefShopMustInfo=" + IsRefShopMustInfo;
            Response.Redirect("ProTypeRefAll.aspx?" + Url + "");
        }
    }
}